<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ProjectMadaktariMVC.Models.Patient>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	View Patient
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("PatientDetails"); %>

    <div class="innerContent">
        <%= Model.Episodes.Count == 0 ? "<em>No Episodes</em>" : "Episodes" %><br /><br />
        
        <% if (Model.Episodes.Count != 0)
           { %>
        <table class="episode_table">
        <tr>
            <th>Date</th>
            <th>Diagnosis</th>
            <th>Hospital</th>
        </tr>
        <% foreach (ProjectMadaktariMVC.Models.Episode episode in Model.Episodes)
           {
               if (episode.episodeID != 0)
               {%>
            <tr class="alternate-<%= (Model.Episodes.IndexOf(episode) % 2) %>">
                <td><%= Html.ActionLink(episode.admitDate == null ? "--" : ((DateTime)episode.admitDate).ToString("MM/dd/yyyy"), "ViewEpisode", new { episodeId = episode.episodeID, patientId = Model.patientID })%> </td>
                <td><%= episode.GetDiagnosesList()%></td>
                <td><%= episode.Hospital.hospitalName%></td>
            </tr>
        <%}
           } %>
        
        </table>
        <%} %>
        <br />
        <%= Html.ActionLink("Add New Episode", "AddEpisode", new { id = Model.patientID}) %>
    </div>
    
    

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
</asp:Content>



<asp:Content ID="Content5" ContentPlaceHolderID="TableSubheader" runat="server">
</asp:Content>
